package com.jcb.countfrench.view;



import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.jcb.countfrench.R;
import com.jcb.countfrench.dao.CountFrenchDAO;

public class AdminView extends LinearLayout {
	Button buttonChoice, buttonReinitTables, buttonReadTables  ;
	public static CountFrenchDAO dao ;
	
	public AdminView(Context context, final CountFrenchDAO dao) {
		super(context);
		this.dao 					=   dao ;
		LayoutInflater layoutInflater 	= (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		layoutInflater.inflate(R.layout.admin,this);
		buttonChoice  					= (Button) findViewById(R.id.deleteQuizzResult);
		buttonReinitTables 				= (Button) findViewById(R.id.buttonReinitTables);
		buttonReadTables 				= (Button) findViewById(R.id.buttonReadTables);
		
			buttonChoice.setOnClickListener(new View.OnClickListener() {
		        public void onClick(View v) {
		        	//quizzDAO.deleteQuizzResult(chinoisActivity.getUser()) ;
		        }
		    });	

			buttonReinitTables.setOnClickListener(new View.OnClickListener() {
		        public void onClick(View v) {
		        	dao.dropTable() ;
		        	dao.createTable() ;
		        	//dao.insertInitialData();
		        }
		    });	

			buttonReadTables.setOnClickListener(new View.OnClickListener() {
		        public void onClick(View v) {
		        	dao.readTables() ;	    			
		        }
		    });	
			

	}

	
	
}
